Skip to main content

All Questions

4votes
1answer
675views

How to find files in subdirectories and copy it to the folder immediately before the location where the file was found

I have the following scheme of file directory: . |-- FOO1 | `-- p58 | `-- file1.csv |-- FOO2 | `-- p63 | `-- file2.csv Note that each of the CSV files is located in the subdirectory ...
littleworth's user avatar
2votes
1answer
372views

Print the name and the size of the largest file [duplicate]

I have to create a script that takes the argument that should be the name of a directory. From there it has to print all the files and then print out the largest one and its size. Please help! Would ...
linda's user avatar
2votes
2answers
2kviews

How to count non empty and empty directories with size 4096

I want to count empty and non empty directories. But all the empty directories and directories that contains files and subdirectories have same size 4096. So empty directories also count in non empty ...
Labh deep's user avatar
0votes
1answer
108views

want to check an element of array is present in first line of a file

while read line ; do if grep -q "${MYARRAY[$i]}" <<< "$line"; then echo its present else echo its not fi i+=1 done < keyans.txt here keyans.txt has all ...
Shivani Nadgir's user avatar
1vote
3answers
242views

I want to write a bash script to separate characters from special characters?

I am new to bash. I want to write a bash script where I have a file, "file.txt". I want to cut & paste normal characters to charecters.txt & special characters to special.txt. ...
IndiGo's user avatar
1vote
1answer
1kviews

Redirect sed file to a another directory under a new name

I have a $template file that will invoke sed to do some templating. after this is done I want to redirect the new $template file to another directory named output and the new file name will be ...
bull's user avatar
0votes
0answers
20views

Move a specific number of files from a folder to another one (by oldest) [duplicate]

I am currently using this shell to move 25 files to another folder automatically. But It moves files by alphabetical order, that's my main concern. I would like the oldest files to be moved first ...
Arno's user avatar
0votes
0answers
66views

Execute a while loop in bash constructed from variables

I am trying to write a shell script which reads a file line by line, does some operations on each line, and write output to a new file. The file name is passed as an argument. Since the file is ...
BHARATH RAJ's user avatar
1vote
2answers
49views

Getting differences between two directories with full details

I have two directories and i need their differences output in this format example : DIR1 conatins : file1 file2 file3 DIR2 contains : file1 ...
yugandhar's user avatar
-1votes
3answers
952views

How do I create always 4 digit sequentially numbered and named file with shell script

I'm trying to create multiple *.txt files with 4-digit numerical names with leading zeros when needed. Script needs to stop when MAX varialbe is reached. This is using /bin/sh (not bash) but any ...
almadinedotnet's user avatar
8votes
1answer
858views

Script to add users will add users but they cannot login

I have a script that will add users from a file. It will add the users just fine as far as I can tell, but when trying to login the password supplied by the script does not work. I'm not sure if this ...
Elite's user avatar
2votes
1answer
103views

I have an issue with a script that does file manipulation

Ive been working on a script that instantaneously detects files created in the Downloads directory then sorts them based on file extension. The issue with this however is that when downloading a file ...
mr Stap's user avatar
0votes
2answers
333views

List lastest modified or newly created files in linux

How to list modified or newly created files or directories in linux. So that I can trigger another command or shell script for another task. for eg. A file a.txt and test.txt are modified and I ...
tomashubham's user avatar
1vote
3answers
2kviews

How to preserve a shell variable data until shutdown?

The shell variable is created by a script. It needs to be retained even after closing terminal and launching another script and accessing it. I don't want to write to a file(in HDD). If it possible ...
Prakash Bhattarai's user avatar
0votes
2answers
898views

Rename multiple files in sub directories to their directory names

I have a folder on my desktop named Models. In the folder, there are named folders with jpeg files without the .jpg extensions. The jpeg file names are random hashes. I would like to use a bash script ...
Boygee's user avatar

153050per page
close